home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / lib / pm-utils / module.d / uswsusp < prev   
Text File  |  2008-10-15  |  2KB  |  92 lines

  1. #!/bin/sh
  2.  
  3. # disable processing of 99video
  4. before_hooks()
  5. {
  6.     disablehook 00clear "disabled by uswsusp"
  7.     disablehook 99video "disabled by uswsusp"
  8. }
  9.  
  10. get_quirks()
  11. {
  12.     OPTS=""
  13.     ACPI_SLEEP=0
  14.     for opt in $PM_CMDLINE; do
  15.         case "${opt##--quirk-}" in # just quirks, please
  16.             dpms-on)        ;; # no-op
  17.             dpms-suspend)        ;; # no-op
  18.             radeon-off)        OPTS="$OPTS --radeontool" ;;
  19.             reset-brightness)  ;; # no-op
  20.             s3-bios)        ACPI_SLEEP=$(($ACPI_SLEEP + 1)) ;;
  21.             s3-mode)        ACPI_SLEEP=$(($ACPI_SLEEP + 2)) ;;
  22.             vbe-post)        OPTS="$OPTS --vbe_post" ;;
  23.             vbemode-restore)   OPTS="$OPTS --vbe_mode" ;;
  24.             vbestate-restore)  OPTS="$OPTS --vbe_save" ;;
  25.             vga-mode3)        ;; # no-op
  26.             save-pci)          OPTS="$OPTS --pci_save" ;;
  27.             none)            QUIRK_NONE="true" ;;
  28.             *) continue ;;
  29.         esac
  30.     done
  31.     [ $ACPI_SLEEP -ne 0 ] && OPTS="$OPTS --acpi_sleep $ACPI_SLEEP"
  32.     # if we were told to ignore quirks, do so.
  33.     [ "$QUIRK_NONE" = "true" ] && OPTS=""
  34. }
  35.  
  36. check_suspend()
  37. {
  38.     command_exists s2ram || return 1
  39.     grep -q mem /sys/power/state || [ -c /dev/pmu ]
  40. }
  41.  
  42. do_suspend()
  43. {
  44.     get_quirks
  45.     s2ram --force $OPTS
  46. }
  47.  
  48. check_hibernate()
  49. {
  50.     [ -f /sys/power/disk ] && \
  51.     grep -q disk /sys/power/state && \
  52.     [ -c /dev/snapshot ] &&
  53.     command_exists s2disk    
  54. }
  55.  
  56. do_hibernate()
  57. {
  58.     s2disk
  59. }
  60.  
  61. check_suspend_hybrid()
  62. {
  63.     grep -q mem /sys/power/state && \
  64.     command_exists s2both && \
  65.     check_hibernate
  66. }
  67.  
  68. do_suspend_hybrid()
  69. {
  70.     get_quirks
  71.     s2both --force $OPTS 
  72. }
  73.  
  74. sleep_method_help()
  75. {
  76.     echo  # first echo makes it look nicer.
  77.     echo "Video quirk handler options:"
  78.     echo
  79.     echo "  --quirk-dpms-on"
  80.     echo "  --quirk-dpms-suspend"
  81.     echo "  --quirk-radeon-off"
  82.     echo "  --quirk-reset-brightness"
  83.     echo "  --quirk-s3-bios"
  84.     echo "  --quirk-s3-mode"
  85.     echo "  --quirk-vbe-post"
  86.     echo "  --quirk-vbemode-restore"
  87.     echo "  --quirk-vbestate-restore"
  88.     echo "  --quirk-vga-mode3"
  89.     echo "  --quirk-save-pci"
  90.     echo "  --quirk-none"
  91. }
  92.